<template>
	<e-popup :show="show" mode="center" round="20rpx">
		<view class="app-password-popup bg-white e-rela">
			<view class="e-p-b-40">
				<view class="text-center">
					<text class="fw-600 e-font-32">请输入登录密码</text>
				</view>
				<image class="app-password-popup__close img-30 e-abso" :src="$staticPath('order/close.png')"
					@tap="$emit('close')">
				</image>
			</view>

			<view class="e-p-b-40 e-flex-items-end e-flex-x-center bg-white" v-if="payMoney">
				<text class="c-red e-font-36">{{$unitEn}}</text>
				<text class="c-red e-font-50">{{payMoney}}</text>
			</view>
			<view>
				<view class="e-flex-xy-center e-p-t-40">
					<view class="">
							<e-input v-model="password" type="password" passwordIconShow border="none" inputAlign="center" style="text-align: center;" placeholder="请输入登录密码"></e-input>
							<view class="app-password-popup__line">
								
							</view>
						<view class="e-m-t-30  text-right" @tap="jump">
							<text class="c-regular">{{ $t('public.忘记密码？') }}</text>
						</view>
					</view>
					
				</view>
				<view class="e-p-l-30 e-p-r-30 e-p-t-60">
					<e-button type="primary" size="large" :disabled="!password" shape="circle" text="确定" @click="handleFinish"></e-button>
				</view>
			</view>
		</view>
	</e-popup>
</template>
<script lang="ts">
	import {
		defineComponent,
		ref
	} from 'vue'
	import {
		useCurrentInstance
	} from '@/common/hooks'
	export default defineComponent({
		name: 'password-popup',
		props: {
			show: Boolean,
			payMoney: [String, Number]
		},
		emit: ['confirm','close'],
		setup(props, {
			emit,
			expose
		}) {
			const ctx = useCurrentInstance()
			const password = ref('')
			const handleFinish = () => {
				uni.hideKeyboard()
				emit('confirm', password.value)
				password.value = ''
			}
			const reset = () => {
				password.value = ''
			}
			const jump = () => {
				emit('close')
				ctx.$goTo('/pages/public/setting/pay-pwd')
			}
			expose({
				reset
			})
			return {
				password,
				handleFinish,
				jump,
				reset
			}
		},
	})
</script>


<style scoped lang="scss">
	@include appBem_b(password-popup) {
		width: 670rpx;
		border-radius: 20rpx;
		padding: 40rpx 0;

		&__close {
			top: 30rpx;
			right: 30rpx;
		}
		&__line {
			width:590rpx;
			border-bottom:2rpx solid #ccc;
		}
	}
</style>